package com.fjh.springboot_01.service.impl;

import com.fjh.springboot_01.mapper.AnnouncementMapper;
import com.fjh.springboot_01.pojo.Announcement;
import com.fjh.springboot_01.service.AnnouncementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AnnouncementServiceImpl implements AnnouncementService {
    
    @Autowired
    private AnnouncementMapper announcementMapper;
    
    @Override
    public void add(Announcement announcement) {
        announcementMapper.insert(announcement);
    }
    
    @Override
    public Announcement findById(Integer id) {
        return announcementMapper.findById(id);
    }
    
    @Override
    public List<Announcement> findPublished() {
        return announcementMapper.findPublished();
    }
    
    @Override
    public List<Announcement> findAll() {
        return announcementMapper.findAll();
    }
    
    @Override
    public void update(Announcement announcement) {
        announcementMapper.update(announcement);
    }
    
    @Override
    public void delete(Integer id) {
        announcementMapper.delete(id);
    }
} 